# The name of the executable file
EXEC=./sample

# Library flags for the linker
LDLIBS= -llagniappe -lpthread
# Flags for the C compiler
CFLAGS=-Wall -O0 -I. -I/usr/local/include -g 

# Change the following options as suited to your system

# The C compiler
CC=gcc
# The C++ compiler
CPPC=g++
# Command used to delete files
RM=rm -rf

CPPSOURCES:= op1.cc NetRequestDevice.cc NetRequest.cc Thread.cc sample.cc
MAIN_SOURCE:= lc_main.cc
OBJSCPP:=$(CPPSOURCES:.cc=.o)
MAIN_OBJ:=$(MAIN_SOURCE:.cc=.o)

all: default

default: depend ${EXEC}

depend: .depend
	@echo --- Generating dependencies
	$(CPPC) $(CFLAGS) -MM $(CPPSOURCES) $(MAIN_SOURCE) > .depend

.depend:
	touch .depend

clean: 
	-$(RM) *.o
	-$(RM) ${EXEC}

include .depend

${EXEC}: $(OBJSCPP) $(MAIN_OBJ)
	@echo --- Linking $@
	${CPPC} $(LDFLAGS) $(OBJSCPP) $(MAIN_OBJ) ${LDLIBS} -o ${EXEC}

$(OBJSCPP) : %.o: %.cc
	@echo --- Compiling $<
	${CPPC} ${CFLAGS} -c $< -o $@
$(MAIN_OBJ) : %.o: %.cc
	@echo --- Compiling $<
	${CPPC} ${CFLAGS} -c $< -o $@



